import 'package:flutter/material.dart';
import 'package:flutter_cached_pdfview/flutter_cached_pdfview.dart';
import 'color.dart';
import 'ht_appbar.dart';

/**
 * @author kxc on 2022/2/28
 * @description
 */
class PdfProtocol extends StatelessWidget {
  final String path;
  const PdfProtocol({Key? key, required this.path}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: ColorManager.colorFFFFFF,
      appBar: htCommonAppbar(
        context,
        title: '',
      ),

      body: const PDF(enableSwipe: true,
        swipeHorizontal:false,
        autoSpacing: false,
        pageFling: false,).fromUrl(
        path,
        placeholder: (double progress) => Container(
            alignment: Alignment.center,
            child: CircularProgressIndicator(
              valueColor:
              AlwaysStoppedAnimation<Color>(ColorManager.colorF87E75),
            )),
        errorWidget: (dynamic error) => Center(child: Text(error.toString())),

      ),
    );
  }
}
